<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
//response.sendRedirect("common/login");
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录页</title>
		<script type="text/javascript" src="${path }/resource/js/jquery-1.8.3.min.js"></script>
		
		<link rel="stylesheet" href="${path }/resource/bootstrap/css/bootstrap.min.css" />
<style type="text/css">
body {
  padding-top: 40px;
  padding-bottom: 40px;
  background-color: #eee;
}

.form-signin {
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
  margin-bottom: 10px;
}
.form-signin .checkbox {
  font-weight: normal;
}
.form-signin .form-control {
  position: relative;
  height: auto;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
</style>
	</head>
	<body>
		<body>
		<div class="container">

      <form class="form-signin">
        <h2 class="form-signin-heading">Pleass Sign in</h2>
        <input id="userAccount" class="form-control" placeholder="userAccount" required="" autofocus="" type="email">
        <input id="userPass" class="form-control" placeholder="Password" required="" type="password">
        <!-- <div class="checkbox">
          <label>
            <input value="remember-me" type="checkbox"> Remember me
          </label>
        </div> -->
        <button class="btn btn-lg btn-primary btn-block" type="button" onclick="login()">Sign in</button>
      </form>

    </div>
		
	</body>
		<script type="text/javascript">
	function login() {
		if ($("#userAccount").val() == "") {
			alert('请输入账号！');
			return false;
		} else if ($("#userPass").val() == "") {
			alert('请输入密码');
			return false;
		}
		$.ajax({
	  		'type':'post',
	  		'url':"${path}/common/enter",
	  		'data':{userAccount : $("#userAccount").val(),userPass : $("#userPass").val()},
	  		'dataType':'json',
	  		'success':function(data,status){
	  			if(data.page!=null&&data.page!=''){
	  				window.location.href = '${path}'+data.page;
	  			}else {
	  				alert(data.info);
	  			}
	  		}
	  	}); 
	}
</script>
	</body>
</html>
